{% from "macros.html" import user_country_flag, tag_list_widget, timeago, user_primary_group %}
<div class="short-summary{% if extra_class %} {{extra_class}}{% endif %}" id="question-{{question.id}}">
    {% if thread.accepted_answer_id %}
        <div class="tick">
            <i class="fa fa-check fa-1x icon"></i>
        </div>
    {% endif %}  
    <div class="question-table">
        <div id="desktop-invisible">
            <div class="counts-ans">
                {% set answer_count = thread.get_answer_count(visitor) %}
                <div class="answers
                    {% if answer_count == 0 -%}
                        no-answers
                    {% else -%}
                        {%- if thread.accepted_answer_id -%}  {# INFO: Use _id to not fetch the whole answer post #}
                        accepted
                    {%- else -%}
                        some-answers
                    {%- endif -%}
                    {%- endif -%}"> 
                    {% if answer_count == 0 %}
                        <span class="item-count">0</span>
                    {% else %}
                        <span class="item-count">
                            {{ answer_count|humanize_counter }}{% if thread.accepted_answer_id %}{% endif %}
                        </span>
                    {% endif %}

                    <div class="fa-icons" style="margin-top: 0.3em">
                        <a href="#" title="Answers" class="main-tooltip">
                            <span title="">
                                <i class="fa fa-pencil icon" style="font-size: 2em;"></i>
                            </span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div id="question-header-tags">
            <h2><a href="{{ question.get_absolute_url(thread=thread) }}">{{thread.get_title()|escape}}</a></h2>
            {{ tag_list_widget(thread.get_tag_names(), search_state=search_state) }}
        </div>
        <div class="counts" id="counts-div">
            <div class="counts-sub">
                {% if thread.view_count == 0 %}
                    <span class="item-count">0</span>
                {% else %}
                    <span class="item-count">{{ thread.view_count|humanize_counter }}</span>
                {% endif %}
                <div class="fa-icons" style="font-size: 1.2em">

                    <a href="#" title="Views" class="main-tooltip">
                        <span title="">
                            <i class="fa fa-eye icon"></i>
                        </span>
                    </a>
                </div>
            </div>
            {% set answer_count = thread.get_answer_count(visitor) %}
            <div class="counts-sub">
                {% if answer_count == 0 %}
                    <span class="item-count">0</span>
                {% else %}
                    <span 
                        class="item-count"
                    >{{ answer_count|humanize_counter }}{% if thread.accepted_answer_id %}{% endif %}</span>
                {% endif %}
                <div class="fa-icons" style="font-size: 1.2em">
                    <a href="#" title="Answers" class="main-tooltip">
                        <span title="">
                            <i class="fa fa-pencil icon"></i>
                        </span>
                    </a>
                </div>
            </div>
            <div class="counts-sub">
                {% if question.score == 0 %}
                    <span class="item-count">0</span>
                {% else %}
                    <span class="item-count">{{question.score|humanize_counter}}</span>
                {% endif %}
                <div class="fa-icons" style="font-size: 1.2em">

                    <a href="#" title="Votes" class="main-tooltip">
                        <span title="">
                            <i class="fa fa-thumbs-up icon"></i>
                        </span>
                    </a>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="userinfo" style="margin-top: -2.9em; font-size: 0.9em; width: 100%; text-align: right; position: absolute;">
    <div style="float: right; margin-bottom: 1.5em; padding-right: 0.5em;">
        {{ timeago(thread.last_activity_at) }}
        {% set latest_revision = thread.get_latest_revision(user=visitor) %}
        {% if latest_revision and latest_revision.is_anonymous %}
            <span class="anonymous">{{ thread.last_activity_by.get_anonymous_name() }}</span>
        {% else %}
            <a href="{% url user_profile thread.last_activity_by.id, thread.last_activity_by.username|slugify %}" style="color: #3c6eb4; text-decoration: none;">{{thread.last_activity_by.username|escape}}</a> {{ user_country_flag(thread.last_activity_by) }}
        {% if thread.last_activity_by.get_primary_group() %}
            - {{ user_primary_group(thread.last_activity_by) }}
        {% endif %}
        {% endif %}
    </div>
</div>
